/**
 * canvas에 그림 그리기
 */
var start=false;
var startX=0, startY=0;
var ctx;
function drawingInit(){
	document.getElementById('canvas').onmousemove=chk;
	document.getElementById('canvas').onmouseup=set;
	ctx = document.getElementById('canvas').getContext('2d');
}
function set(ev){
	var lc;
	var lw;
	start = !start;
	startX = ev.x;
	startY = ev.y;
	//선그리기 시작점 설정
	if(start){
		ctx.beginPath();
		ctx.moveTo(startX, startY);
		lc = document.getElementById('linecolor');
		lw = document.getElementById('linewid');
		ctx.strokeStyle=lc.value;
		ctx.lineWidth = lw.value;
		
	}else{
		ctx.closePath();
	}
	
}
function chk(e){
	var d = document.getElementById("result");
	var x = e.x;
	var y = e.y;
	
	d.innerHTML = 'x=' + x + ', y=' + y;
	if(start){
	ctx.lineTo(x,y);
	ctx.stroke();
}
}